package com.qf.utils;

import com.qf.enums.OAExceptionEnum;
import com.qf.exception.OAException;
import com.qf.vo.ResultVO;

public class R {

    public static ResultVO ok(Object data){
        ResultVO vo = new ResultVO(0,"",data);
        return vo;
    }

    public static ResultVO ok(){
        return ok(null);
    }

    public static ResultVO error(Integer code, String msg){
        ResultVO vo = new ResultVO(code,msg,null);
        return vo;
    }

    public static ResultVO error(OAException ex){
        return error(ex.getCode(),ex.getMessage());
    }

    public static ResultVO error(OAExceptionEnum pfe){
        return error(pfe.getCode(),pfe.getMsg());
    }
}
